﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using DataAccessLayer.DataInterfaces;
using MyCommon;

namespace DataAccessLayer
{
    public class BaoCaoDAO : IBaoCao
    {
        private static QLBaoHanh dataContext;
        public BaoCaoDAO()
        {
            dataContext = new QLBaoHanh();
        }

        public IEnumerable<View_PhieuTiepNhan> GetPhieuTiepNhanByDate(List<int> inTrangThaiPhieuList, DateTime inFromDate, DateTime inToDate)
        {
            DateTime FromDate = new DateTime(inFromDate.Year, inFromDate.Month, inFromDate.Day, 0, 0, 0);
            DateTime ToDate = new DateTime(inToDate.Year, inToDate.Month, inToDate.Day, 23, 59, 59);
            return dataContext.View_PhieuTiepNhan.Where(
                o =>
                     inTrangThaiPhieuList.Contains((int)o.TrangThaiPhienId)&&
                     o.ThoiGianNhan >= FromDate &&
                     o.ThoiGianNhan <= ToDate).Select(aObj => (View_PhieuTiepNhan)aObj);
        }
    }
}
